package rsj.service;

import java.sql.Connection;
import java.sql.SQLException;

import com.rlyy.aibase.utils.base.MapNode;

import rsj.dao.LogInfoDao;
import rsj.db.dbutils.UniqueID;

public class LogInfoService {
	 private static final LogInfoService infoService = new LogInfoService();

	 public static LogInfoService getInstance(){
	     return infoService;
	 }

	private static LogInfoDao infoDao = LogInfoDao.getInstance();
	
	public MapNode findLogList(Connection conn,MapNode data)throws SQLException{
		int size = data.getValueIntDef("Page_Size", 10);
		int pcount = data.getValueIntDef("Page_Count", 1);
		String userId = data.getValue("User_Id");
		
		return infoDao.findLogList(conn, userId, size, pcount);
	}
	
	public void insertLog(Connection conn,MapNode data,String location,String operation,String level,String content)throws SQLException{
		String id = String.valueOf(UniqueID.generateId());
		String userId = data.getValue("User_Id");
		String userName = data.getValue("User_Uname");
		String ip = data.getValue("User_Ip");
		
		infoDao.insertLog(conn, id, userId, userName, ip, location, operation, level, content);
	}
	

}
